package model;

/**
 *
 * @author José Ignacio Rivero Dávila
 */
public enum Checker {
    RED('R'),
    REDKING('W'),
    BLACKKING('M'),
    BLACK('B'),
    EMPTY('-');
    private final char representation;
    Checker(char rep){
        representation = rep;
    }
    @Override
    public String toString(){
        return representation+"";
    }
    public boolean isOpponent(Checker other){
        switch(this){
            case RED:
                return other.equals(BLACK) || other.equals(BLACKKING);
            case REDKING:
                return other.equals(BLACK) || other.equals(BLACKKING);
            case BLACK:
                return other.equals(RED) || other.equals(REDKING);
            case BLACKKING:
                return other.equals(RED) || other.equals(REDKING);
            default: return false;
        }
    }
    
    public boolean isFriend(Checker other){
        switch(this){
            case RED:
                return other.equals(RED) || other.equals(REDKING);
            case REDKING:
                return other.equals(RED) || other.equals(REDKING);
            case BLACK:
                return other.equals(BLACK) || other.equals(BLACKKING);
            case BLACKKING:
                return other.equals(BLACK) || other.equals(BLACKKING);
            default: return false;
        }
    }
    
    public boolean isRed(Checker checker){
        return checker==Checker.RED || checker==Checker.REDKING;
    }
    public boolean isBlack(Checker checker){
        return checker==Checker.BLACK || checker==Checker.BLACKKING;
    }
    
}
